
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>
<meta name="keywords" content="{$SEO['keyword']}">
<meta name="description" content="{$SEO['description']}">
<link href="{THEME_STYLE_PATH}style/css/default_new.css" type="text/css" rel="stylesheet" />
<script src="{THEME_STYLE_PATH}style/js/jquery.min.js"></script>
<script src="{THEME_STYLE_PATH}style/js/core.js"></script>
<!--script src="http://l.tbcdn.cn/apps/top/x/sdk.js?appkey=21635038"></script-->
<link href="{THEME_STYLE_PATH}style/css/percenter.css" type="text/css" rel="stylesheet">
<!--[if IE 6]>
<script src="/js/DD_belatedPNG.js"></script>
<script>
  DD_belatedPNG.fix('*');
</script>
<![endif]-->
<!--[if IE 6]>
<style type="text/css">
    html{overflow:hidden;}
    body{height:100%;overflow:auto;}
</style>
<![endif]-->
</head>

<body>
	
	{include template('header','common')}	
	<div id="Mainbox">
	<!--插入侧边栏-->
		{include template('sidebar_login','common')}
		<!--插入侧边栏-->
		{include template('top_advance','common')}
		
		<!-- 左侧 -->
		{include template('member_left','common')}
		<!--右侧-->
		<div class="percenter_right">
			<div class="aboutper_acc" style="margin-bottom:70px;">
				<p class="a1" style="margin-bottom:0px;">修改登录密码</p>
				<ul class="editpsw">
					<li class="a1"><strong>登录邮箱：</strong></li>
					<li class="a2"></li>
					<li class="a1"><strong>当前密码：</strong></li>
					<li class="a2"><input type="password" name="tbUserPwd" id="tbUserPwd"/>&nbsp;&nbsp;<span class="da3" id="tbUserPwd_i">正在使用的密码</span><span class="re1" id="tbUserPwd_w" style="display:none;">格式输入有误!</span><img id="tbUserPwd_s" src="{THEME_STYLE_PATH}style/images/right.png"  style="vertical-align:-5px;display:none;"/></li>
					<li class="a1"><strong>新的密码：</strong></li>
					<li class="a2"><input type="password" name="tbNewPwd" id="tbNewPwd" />&nbsp;&nbsp;<span class="da3" id="tbNewPwd_i">请输入6-16位字符的密码</span><span class="re1" id="tbNewPwd_w" style="display:none;">格式输入有误!</span><img id="tbNewPwd_s" src="{THEME_STYLE_PATH}style/images/right.png"  style="vertical-align:-5px;display:none;"/></li>
					<li class="a1"><strong>确认密码：</strong></li>
					<li class="a2"><input type="password" name="tbCmPwd" id="tbCmPwd" />&nbsp;&nbsp;<span class="da3" id="tbCmPwd_i">请再输入一次新密码</span><span class="re1" id="tbCmPwd_w" style="display:none;">格式输入有误!</span><img id="tbCmPwd_s" src="{THEME_STYLE_PATH}style/images/right.png"  style="vertical-align:-5px;display:none;"/></li>
					<li class="a1"><strong>验证码：</strong></li>
					<li class="a2">
						<input type="text" style="width:50px;" maxlength="6" id="tbCode" _type="2"/>&nbsp;&nbsp;
						<span id="phoneArea">
							<a href="javascript:void(0);" onclick="getCode()" class="b40link">点击获取手机验证码</a>
													</span>
						<img id="tbCode_s" src="{THEME_STYLE_PATH}style/images/right.png"  style="vertical-align:-5px;display:none;"/>
						<span class="da3" id="tbCode_i"></span>
						<span class="re1" id="tbCode_w" style="display:none;">格式输入有误!</span>
						<span id="errorTip" class="re1" style="font-size: 12px;"></span>
					</li>
					<li class="a1"></li>
					<li class="a2" style="margin-top:10px;"><a href="javascript:void(0);" class="editbtn" onclick="modifyPwd(1)">确认修改</a></li>
				</ul>
			</div>	
			<div class="psw_line"></div>
						
					</div>
		<!--右侧-->
		<div class="clear"></div>
	</div>
	<!--主体-->
	<!--尾部-->
	{include template('footer','common')}

	
	

	<!--尾部-->
</body>
</html>
<script type="text/javascript">
var pwd = false,newPwd = false,cmPwd = false,moPwd = false,newMoPwd = false,cmMoPwd = false,coder = false;
var pwd_v = '',moPwd_v = '';var pwd_w = '',moPwd_w = '';
var reg_pwd = /^[A-Za-z0-9]{6,16}$/;
$(document).ready(function() {
	/*修改登录密码begin*/
	$('#tbUserPwd').focus(function(){
		var id = this.id;
		$('#'+id+'_i').css('color','black');switchTip('tbUserPwd',0);
	}).blur(function(){
		var id = this.id;var value = $.trim($(this).val());
		if(value){
			if (!reg_pwd.exec(value)){
				$('#'+id+'_w').html('格式输入有误!');switchTip('tbUserPwd',2);pwd = false;
			}else{
				if(value!=pwd_v){
					$.ajax({
						type: "POST",
						url: "{U('Member/Profile/password_edit')}",
						dataType: "json",
						data : {"act":"checkPwd","pwd":value},
						success: function(data){
							if(data.flag==1){
								switchTip('tbUserPwd',1);pwd = true;
							}else{
								moPwd_w = data.msg;$('#'+id+'_w').html(data.msg);switchTip('tbUserPwd',2);pwd = false;
							}
						}
					});
				}else{
					if(pwd) switchTip('tbUserPwd',1);
					else{$('#'+id+'_w').html(moPwd_w);switchTip('tbUserPwd',2);}
				}
			}
		}else{
			pwd = false;$('#'+id+'_i').css('color','#a3a3a3');switchTip('tbUserPwd',0);
		}
	});
	
	$('#tbNewPwd').focus(function(){
		var id = this.id;
		$('#'+id+'_i').css('color','black');switchTip('tbNewPwd',0);
	}).blur(function(){
		var id = this.id;var value = $.trim($(this).val());var _value = $.trim($('#tbCmPwd').val());
		if(value){
			if (!reg_pwd.exec(value)){
				$('#'+id+'_w').html('格式输入有误!');switchTip('tbNewPwd',2);newPwd = false;
			}else{
				switchTip('tbNewPwd',1);newPwd = true;
				if(value==_value){
					switchTip('tbCmPwd',1);cmPwd = true;
				}else if(_value){
					switchTip('tbCmPwd',1);cmPwd = false;
				}
			}
		}else{
			newPwd = false;$('#'+id+'_i').css('color','#a3a3a3');switchTip('tbNewPwd',0);
		}
	});
	
	$('#tbCmPwd').focus(function(){
		var id = this.id;
		$('#'+id+'_i').css('color','black');switchTip('tbCmPwd',0);
	}).blur(function(){
		var id = this.id;var value = $.trim($(this).val());
		var _value = $.trim($('#tbNewPwd').val());
		if(value){
			if (!reg_pwd.exec(value)){
				$('#'+id+'_w').html('格式输入有误!');switchTip('tbCmPwd',2);cmPwd = false;
			}else if(value!=_value){
				$('#'+id+'_w').html('两次输入的密码不同!');switchTip('tbCmPwd',2);cmPwd = false;
			}else{
				switchTip('tbCmPwd',1);cmPwd = true;
			}
		}else{
			cmPwd = false;$('#'+id+'_i').css('color','#a3a3a3');switchTip('tbCmPwd',0);
		}
	});
	/*修改登录密码end*/
	
});
function modifyPwd(sign)
{
	
	if(sign==1)
	{
			var pwd_v = $.trim($('#tbUserPwd').val());
			var newPwd_v = $.trim($('#tbNewPwd').val());
			var cmPwd_v = $.trim($('#tbCmPwd').val());
			var code_r = $.trim($('#tbCode').val());
			
			$.ajax({
				type: "POST",
				url: "{U('Member/Profile/pwd_info')}",
				dataType: "json",
				data : {"act":"modifyPwd","pwd":pwd_v,"newpwd":newPwd_v,'cmpwd':cmPwd_v,'coder':code_r},
				
				success: function(data){
					if(data.flag==1){
						juxiangyou.component.popup._href = "{U('Member/Index/login')}";
						juxiangyou.component.popup.prompt(data.msg,300);
					}else{
						juxiangyou.component.popup._reload = false;
						juxiangyou.component.popup.prompt(data.msg,300);
					}
				}
			});
		
	}
	
	
}



function getCode()
{
	$.ajax({
		type: "POST",
		url: "{U('Member/Profile/pwd_code')}",
		dataType: "json",
		data : {"act":"getCode"},
		success: function(data){
			if(data.flag ==1){
				ShowSecond(parseInt(60)); 
			}else{
				$('#tbCode_w').html(data.msg);switchTip('tbCode',2);
			}
		}
	});
}

function ShowSecond(cDate)
{
	if(cDate > 1){
		var _html = '<span id="lastTime"><span style="color:red">'+(--cDate)+'</span>秒后可重新发送</span>';
		
		$('#phoneArea').html(_html);
		setTimeout("ShowSecond("+cDate+")",1000);
	}
	else{
		var _html = '<a href="javascript:void(0);" onclick="getCode()" class="b40link">点击获取验证码</a>';
		$('#phoneArea').html(_html);
	} 

}
function switchTip(id,sign)
{
	var iObject = $('#'+id+'_i');
	var wObject = $('#'+id+'_w');
	var sObject = $('#'+id+'_s');
	if(sign==1){iObject.hide();wObject.hide();sObject.show();}
	else if(sign==2){iObject.hide();wObject.show();sObject.hide();}
	else{iObject.show();wObject.hide();sObject.hide();}
}
</script>
